<?PHP	
	$expr_name = $_GET['expr_name'];
	
	if($expr_name == "asynPair")
	{
		$table_name_answer = make_table_name($drama_name, $expr_name, "answer");
		$query_answer = "SELECT * FROM $table_name_answer WHERE userId = '$user_id' ORDER BY answerIndex ASC;";
		$answer_info = sql_list($query_answer);
		$n_answer_info = count($answer_info);
		
		$table_name_question = make_table_name($drama_name, $expr_name, "question");
		$query_question = "SELECT * FROM $table_name_question;";
		$question_info = sql_list($query_question);
				
		$response = array();
		$answerIndex = array();
		$answer = array();
		$exampleImageFirst = array();
		$problemIndex = array();

		$questionImage = array();
		$questionText = array();
		$imageNextPair = array();
		$textNextPair = array();

		for($i=0; $i<$n_answer_info; $i++)
		{
			$answer_info_one = $answer_info[$i];
			$response[$i] = $answer_info_one['response'];
			$answerIndex[$i] = $answer_info_one['answerIndex'];
			$answer[$i] = $answer_info_one['answer'];
			$exampleImageFirst[$i] = $answer_info_one['exampleImageFirst'];
			$problemIndex[$i] = $answer_info_one['problemIndex'];

			for($j = 0 ; $j < $n_problem_per_session ; $j++)
			{	
				$question_info_one = $question_info[$j];
				if( $problemIndex[$i] == $question_info_one['problemIndex'] )
				{	
         				$questionImage[$i] = $question_info_one['questionImage'];
         				$questionText[$i] = $question_info_one['questionText'];
         				$imageNextPair[$i] = $question_info_one['imageNextPair_image'];
					$textNextPair[$i] = $question_info_one['textNextPair_image'];
					break;
				}
			}
              	}		
			
	}
?>	

<table style="width:100%;height:50px;border:5px #CCCCCC solid;"style="width:100%;height:50px;border:5px #CCCCCC solid;">
	<tr>
		<td colspan=2 align="center" valign="middle" style="font-zise:15px;font-weight:bold;">
		Drama Type <?= $expr_name ?> Result<br />
		<br />
		</td>
	</tr>
	<tr>
		<td align="center">
			<hr />
		</td>
	</tr>
	<tr>
		<td align="center">
<?PHP
	if($n_answer_info == 0)
	{
		echo("No result.<br />");
	}
	else
	{
?>
			
			<table width="100%" border="1px">
				<tr align="center">
					<td>ProblemIndex</td>
					<td>AnswerIndex</td>
					<td>Answer</td>
					<td>Response Time</td>
					<td>QuestionImage</td>
					<td>QuestionText</td>
					<td>Image Next Pair</td>
					<td>Text Next Pair</td>
					<td>Image First?</td>

				</tr>
<?PHP
			for($i=0; $i<$n_answer_info; $i++)
			{
?>
				<tr align="center">
					<td><?= $problemIndex[$i] ?></td>
					<td><?= $answerIndex[$i] ?></td>
					<td><?= $answer[$i] ?></td>
					<td><?= $response[$i] ?></td>
				
					<td><?= $questionImage[$i] ?></td>
					<td><?= $questionText[$i] ?></td>
					<td><?= $imageNextPair[$i] ?></td>
					<td><?= $textNextPair[$i] ?></td>
					<td><?= $exampleImageFirst[$i] ?></td>
					
				</tr>
<?
			}
	}
?>
			
			</table>
			<br>
		</td>
	</tr>	
</table>

